home *** CD-ROM | disk | FTP | other *** search
/ Java Certification Exam Guide / McGrawwHill-JavaCertificationExamGuide.iso / pc / Web Links and Code / code / chap16 / Flower.java < prev   
Encoding:
Java Source  |  1997-04-20  |  511 b   |  15 lines

  1. public class Flower {
  2.    public static void main(String[] args) {
  3.       if (args.length == 0)
  4.          System.out.println("I like all flowers");
  5.       else if (args.length == 1)
  6.          System.out.println("My favoriate flower is a " + args[0]);
  7.       else { 
  8.          System.out.print("My favorite flowers are " + args[0]);
  9.          for (int i = 1; i < args.length - 1; i++)
  10.             System.out.print(", " + args[i]);
  11.          System.out.println(" and " + args[args.length-1]);
  12.       }
  13.    }
  14. }
  15.